<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<t:base type="jquery,easyui,tools,DatePicker"></t:base>

<div id="main_ddata_list" class="easyui-layout" fit="true">
    <div region="north" style="padding:0px;border:0px">
         <table style="width: 100%;" cellpadding="0" cellspacing="1"  border="0" class="formtable" align="center">
	       <tr height="40" >
				<td>
				    <label style="padding:2px;"> 班组  </label>
				    <select name="bzId" id="bzId" style="margin-left:5px;width:160px;"  onchange="setCheckerName(this.value,'');">
					         <option value="">请选择</option>	
					         <!-- 遍历班组-->			
			                 <c:forEach var="team" items="${teamLst }" >                      
					             <option value="${team.bzId }">${team.bzName }</option>
					         </c:forEach>
				    </select>
				    
				    <label class="Validform_label" style="width:140px;"><span style="color:red;">*</span> 用检员: </label> 
					<select name="checkerName" id="checkerName" style="width:160px;height:30px;" value="">
					       <option value="" >请选择</option>
		                  
			        </select>
				   
				   <label style="padding:2px;"> 日期  </label>
				   <input class="Wdate" onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})" style="width: 180px;" id="createDate"
						       name="createDate" ignore="ignore" value="">
	                <a href="#" class="easyui-linkbutton"  plain="true" iconCls="icon-search"  style="margin-left:5px;" onclick="myquery();" >查 询</a>
	                <a href="#" class="easyui-linkbutton"  plain="true" iconCls="icon-cancel"  style="margin-left:5px;" onclick="myreset();" >清 空</a>
				</td>
				
			</tr>
		 </table>
	   </div>
    <div region="center" style="padding:0px;border:0px;">
        <t:datagrid name="ddataList" title="日数据维护" actionUrl="homeController.do?ddataGrid" idField="id" treegrid="false" pagination="true"  sortOrder="desc" sortName="createDate" onLoadSuccess="">
            <t:dgCol title="唯一标识" field="id"  width="30" hidden="true"></t:dgCol>
            <t:dgCol title="日期" field="createDate"  width="100" ></t:dgCol>
            <t:dgCol title="班组名称" field="bzName" width="100" ></t:dgCol>
            <t:dgCol title="用检员" field="checkerName" width="100" ></t:dgCol>
            <t:dgCol title="累计欠费" field="arrearage" width="100"></t:dgCol>
            <t:dgCol title="累计回收率" field="rateofrecovery" width="100"></t:dgCol>
            <t:dgCol title="累计已办结传票数" field="summon" width="100"></t:dgCol>
            <t:dgCol title="累计已办结95598工单数" field="wos95598" width="100"></t:dgCol>
            <t:dgCol title="累计已办结12345工单数" field="wos12345" width="100"></t:dgCol>
            <t:dgCol title="掌上电力推广户数" field="parlmExtension" width="100"></t:dgCol>
            <t:dgCol title="低压费控推广户数" field="lowExtension" width="100"></t:dgCol>
            <t:dgCol title="高压费控转换率" field="highExtension" width="100"></t:dgCol>
            <t:dgCol title="common.operation" field="opt" width="50"></t:dgCol>
            <t:dgDelOpt url="homeController.do?delDdate&id={id}" title="删除"></t:dgDelOpt> 
            <t:dgToolBar title="新增" icon="icon-add" url="homeController.do?aouDdata" funname="add" height="565"></t:dgToolBar>
            <t:dgToolBar title="编辑" icon="icon-edit" url="homeController.do?aouDdata" funname="update" height="565"></t:dgToolBar>
            <t:dgToolBar title="导入" icon="icon-put" funname="ImportXls"></t:dgToolBar>
            <t:dgToolBar title="templateDownload" icon="icon-putout" funname="ExportXlsByT"></t:dgToolBar>
        </t:datagrid>
    </div>
    
</div>

<script type="text/javascript">
    $(function() {
        
    });
    
    function myquery(){
		 //班组编号
	    var bzId = $('#bzId').val();
	    //用检员
	    var checkerName = $('#checkerName').val();
		 //日期
	    var createDate = $('#createDate').val();		
		
		$('#ddataList').datagrid({
			queryParams: {
				bzId: bzId,
				createDate: createDate,
				checkerName:checkerName
			}
		});

	}
    
    function myreset(){
		$('#bzId').val('');
		$('#createDate').val('');
		$('#checkerName').val('');
	}
    
    function setCheckerName(bzId,checkerName){	
    	
		 $.getJSON('homeController.do?getCheckersByBzId&bzId='+bzId, function (data) {  
            if (data.success) {   
           	   $("#checkerName").empty(); 
           	   $("#checkerName").append("<option value=''>请选择</option>"); 
           	   $.each(data.obj,function(n,value) { 
           		   var option = '';
           		   var cName = value.checkerName.trim();
           		   
           		   if(checkerName==cName){    
           			   option = $("<option selected>").val(cName).text(cName); 
           		   }else{
           			   option = $("<option>").val(cName).text(cName); 
           		   }
           		   
               	   $("#checkerName").append(option); 
           	   });
           	  
            } else {  
                alert('提示', data.msg);  
            }  
        });
	}
    
	//模板下载
	function ExportXlsByT() {
		JeecgExcelExport("homeController.do?exportXlsByDdataT","ddataList");
		
	}
	
	//导入
	function ImportXls() {
		$.dialog.setting.zIndex = getzIndex(true);
	    openuploadwin('班级重点工作日数据导入', 'homeController.do?uploadDayForm', "ddataList");
	}
</script>
